package com.syq.controller;

import com.syq.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: RestController
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/12 11:40
 */

@Controller
@RequestMapping("/rest")
public class RestController {

//  @PathVariable:路径变量，从路径上获取变量
    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){
        System.out.println(id);
        return "hhh";
    }

    @PutMapping("/{id}")
    public String update(@PathVariable Integer id,User user){
        System.out.println(id);
        System.out.println(user);
        return "hhh";
    }

    @PostMapping ("")
    public String add(User user){
        System.out.println(user);
        return "hhh";
    }

    @GetMapping("/{id}")
    public String select(@PathVariable Integer id){
        System.out.println("查询:"+id);
        return "hhh";
    }
}
